package cn.kinoko.service.common.export;

import cn.kinoko.common.base.model.BaseEnum;

import java.util.Arrays;
import java.util.List;

/**
 * @author kinoko
 */
public enum ExportTopicEnum implements BaseEnum<Integer> {

    MANGA_ZIP(1, "漫画压缩包"),
    ;

    private final Integer code;

    private final String desc;

    ExportTopicEnum(int type, String title) {
        this.code = type;
        this.desc = title;
    }

    @Override
    public Integer getCode() {
        return code;
    }


    @Override
    public String getDesc() {
        return desc;
    }

    public static ExportTopicEnum getType(int type) {
        for (ExportTopicEnum v : values()) {
            if (v.getCode() == type) {
                return v;
            }
        }
        throw new IllegalArgumentException();
    }

    public static boolean isNotExist(int type) {
        for (ExportTopicEnum v : values()) {
            if (v.getCode() == type) {
                return false;
            }
        }
        return true;
    }

    public static List<ExportTopicEnum> getList() {
        return Arrays.asList(values());
}

}